/*
	Name: 埃及分数
	Author: There,hello
	Date: 07-11-19 20:20
	Description: LOJ 10020
	Algorithm: 迭代加深
*/
#include<bits/stdc++.h>
using namespace std;
int a,b,gc,k;
int ans[10000],tail;
int dep[10000],last;
long long gcd(long long x,long long y){
    while(y){
        long long t=x%y;
        x=y;
        y=t;
    }
    return x;
}
void dfs(int depth,int x,int y,int per){
    if(depth==k){
        if(x==1&&y>per&&y<last){
            tail=depth;
            ans[depth]=y;
            last=y;
            for(int i=1;i<depth;++i)
                ans[i]=dep[i];
        }
        return;
    }
    int down=max(y/x,per+1),up=(long long)(k-depth+1)*y/x;
    for(int i=down;i<=up;++i){
        long long xx=(long long)x*i-y,yy=(long long)y*i;
        gc=gcd(xx,yy);
        xx/=gc;yy/=gc;
        dep[depth]=i;
        dfs(depth+1,xx,yy,i);
    }
}
int main(){
    cin>>a>>b;
    gc=gcd(a,b);
    a/=gc;b/=gc;
    dfs(a,b,1,1);
    for(int i=2;;++i){
        k=i;
        last=0x3f3f3f3f;
        dfs(1,a,b,1);
        if(tail)break;
    }
    for(int i=1;i<=tail;++i)
    printf("%d ",ans[i]);
}